In computer system design and programming, a “thread” or “thread of execution” is a sequence of instructions being executed by a processor. In many computer systems, multiple threads can be executed in parallel. This “multithreading” may be supported by a single processor that switches between different threads, or by multiple processors each processing one or more threads.
In a multithreaded system, mechanisms may be required to handle situations in which multiple threads attempt to concurrently access a particular shared resource (e.g., a shared memory location). Such mechanisms often involve the use of “locks” which temporarily prevent the shared resource from being accessed by more than one thread. The single thread permitted to access the shared resource is said to have “acquired” or “obtained” the lock. A thread wishing to access the shared resource must first acquire or obtain the lock. When the thread is finished using the shared resource, the thread may “release” the lock so that the shared resource may become available to another thread.